package com.itheima;

import com.hankcs.algorithm.AhoCorasickDoubleArrayTrie;
import com.heima.file.service.FileStorageService;
import com.heima.wemedia.WemediaApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

@SpringBootTest(classes = WemediaApplication.class)
@RunWith(SpringRunner.class)
public class Tset2 {

    @Autowired
    private FileStorageService fileStorageService;
    @Test
    public void Test1() throws IOException {
        File file = new File("E:\\develop\\study\\黑马头条\\黑马头条\\黑马头条\\day08-平台管理[实战]\\资料\\后台数据图\\live_image.jpg");
        InputStream inputStream = new FileInputStream(file);
        String path = UUID.randomUUID() + ".png";
        String url = fileStorageService.uploadImgFile("", path, inputStream);
        inputStream.close();
        System.out.println(url);
    }
}
